﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Medianamik.Core.Security;
using Medianamik.Core.Interfaces;

namespace Medianamik.Core
{
    public struct NodeDataShell
    {
        public NodeDataShell(Node node)
        {
            _node = node;
            _properties = new List<NodeProperty>();
            _instances = new List<NodeInstance>();
            _deletedInstances = new List<NodeInstance>();
            _manyToManyNodes = new List<ManyToManyRelationNode>();
            _oldValues = new Dictionary<NodeProperty, object>();
            _deletedManyToManyNodes = new List<ManyToManyRelationNode>();
        }

        public NodeDataShell(Node node,
                IEnumerable<NodeProperty> properties,
                IEnumerable<NodeInstance> instances,
                IEnumerable<NodeInstance> deletedInstances,
            IEnumerable<ManyToManyRelationNode>  manyToManyNodes,
                IEnumerable<ManyToManyRelationNode> deletedManyToManyNodes,
            Dictionary<NodeProperty, object> oldValues)
        {
            _node = node;
            _properties = properties;
            _instances = instances;
            _deletedInstances = deletedInstances;
            _manyToManyNodes = manyToManyNodes;
            _oldValues = oldValues;
            _deletedManyToManyNodes = deletedManyToManyNodes;
        }

        public Node Node { get { return _node; } }
        private Node _node;

        public IEnumerable<NodeProperty> Properties { get { return _properties; } }
        IEnumerable<NodeProperty> _properties;

        public IEnumerable<NodeInstance> Instances { get { return _instances; } }
        IEnumerable<NodeInstance> _instances;

        public IEnumerable<NodeInstance> DeletedInstances { get { return _deletedInstances; } }
        IEnumerable<NodeInstance> _deletedInstances;

        public IEnumerable<ManyToManyRelationNode> ManyToManyNodes { get { return _manyToManyNodes; } }
        IEnumerable<ManyToManyRelationNode> _manyToManyNodes;

        public IEnumerable<ManyToManyRelationNode> DeletedManyToManyNodes { get { return _deletedManyToManyNodes; } }
        IEnumerable<ManyToManyRelationNode> _deletedManyToManyNodes;

        public IDictionary<NodeProperty, object> OldValues { get { return _oldValues; } }
        IDictionary<NodeProperty, object> _oldValues;
    }
}
